
<div class="content margin_top">
    <header class="header fixed_top bg_mx_green"></header>
    <div class="font_16 margin_b_10 bg_white lineheight_4 text_center flex title_nav" style="padding:0">
        <div class="flex_1 <{if is_null($status)}>active_border<{/if}>"><a href="<{url route='/business/user/pig-order/index'}>">全部</a></div>
        <div class="flex_1 <{if $status==='0'}>active_border<{/if}>"><a href="<{url route='/business/user/pig-order/index?status=0'}>">待付款</a></div>
        <div class="flex_1 <{if $status==1}>active_border<{/if}>"><a href="<{url route='/business/user/pig-order/index?status=1'}>">已支付</a></div>
        <div class="flex_1 <{if $status==3}>active_border<{/if}>"><a href="<{url route='/business/user/pig-order/index?status=3'}>">退款单</a></div>
    </div>
    <div class="order_list"></div>
</div>
<script type="text/template" charset="utf-8" id='order_template'></script>
<script>
    // 页面初始化
    var order_list = <{$orderlist}>;console.log(order_list);
    loadorder_rasing(order_list);
    loadheadbar("认养订单管理");
    // 取消订单
    function quit_order(n){
        $.post("/business/user/pig-order/cancal",{id:n,_csrf:'<{$app->request->csrfToken}>'},function(res){
            alert(res.msg);
            if(res.status==0){
                window.location.reload()
            }
        },"json")
    }
    // 支付
    function pay_order(n){
        location.href='/pay/wechat/pay/rasing?oid='+n;
    }

    // 申请退款
    function refund_order(n){
        $.post("/business/user/pig-order/refund",{id:n,_csrf:'<{$app->request->csrfToken}>'},function(res){
            alert(res.msg);
            if(res.status==0){
                window.location.reload()
            }
        },"json")
    }

    //取消退款申请
    function refund_cancal(n){
        $.post("/business/user/pig-order/refund-cancal",{id:n,_csrf:'<{$app->request->csrfToken}>'},function(res){
            alert(res.msg);
            if(res.status==0){
                window.location.reload()
            }
        },"json")
    }



    // 评价
    function comment_order(n,oid){
        location.href = "/farmerhouse/site/comment?hid="+n+'&oid='+oid;
    }

</script>


